package com.tank.action.itemsObjct;

import org.springframework.beans.factory.annotation.Autowired;

import com.opensymphony.xwork2.ActionSupport;
import com.tank.bean.User;
import com.tank.bean.item.Product;
import com.tank.dao.ItemsManageDao;
import com.tank.service.ItemsManageService;
import com.tank.util.TankUtil;

public class ItemshowAction extends ActionSupport{

	private Integer productId;
	private Product product;
	private User cuUser;
	private long cuUserId;
	@Autowired
	private ItemsManageService itemsManageService;
	@Override
	public String execute() throws Exception {
		product = itemsManageService.querySingleItems(productId);
		cuUserId = TankUtil.getCurrentUser().getId();
		System.out.println(cuUserId == product.getAuthor().getId());
		if(cuUserId == product.getAuthor().getId()){
			System.out.println("cuUserItem");
			return "cuUserItem";
		}else {
			System.out.println("othUserItem");
			return "othUserItem";
		}
		
	}
	public Integer getProductId() {
		return productId;
	}
	public void setProductId(Integer productId) {
		this.productId = productId;
	}
	public Product getProduct() {
		return product;
	}
	public void setProduct(Product product) {
		this.product = product;
	}
	public User getCuUser() {
		return cuUser;
	}
	public void setCuUser(User cuUser) {
		this.cuUser = cuUser;
	}
	public long getCuUserId() {
		return cuUserId;
	}
	public void setCuUserId(long cuUserId) {
		this.cuUserId = cuUserId;
	}
	
}
